using System.Data;
using Butterfly.Library.Components.Providers;

namespace Butterfly.Library.Components.Partner
{
    public class PartnerController
	{
		public static DataTable GetPartners()
		{
           // const string key = "Butterfly.Portal.Partner.GetPartner";
			//DataCaching data = new DataCaching();
            DataTable dtGetPartners ;//= (DataTable)data.GetCache(key);
            //if (dtGetPartners != null) return dtGetPartners;
            dtGetPartners = DataAccessProvider.Instance().GetPartners();
           // data.InsertCache(key, dtGetPartners, AppEnv.GetTimeCacheExpire());
            return dtGetPartners;
		}
        public static DataTable GetPartners(string keyword, string searchby, string filter)
        {
            return DataAccessProvider.Instance().GetPartners(keyword, searchby, filter);
        }
        public static PartnerInfo GetPartner(int partnerId)
        {
            return DataAccessProvider.Instance().GetPartner(partnerId);
        }
        public static int AddPartner(PartnerInfo partner)
		{
            int id = DataAccessProvider.Instance().AddPartner(partner);
            //const string key = "Butterfly.Portal.Partner.GetPartners";
            //DataCaching data = new DataCaching();
            //data.RemoveCache(key);
			return id;
		}
        public static void UpdatePartner(PartnerInfo partner)
		{
            DataAccessProvider.Instance().UpdatePartner(partner);
            //const string key = "Butterfly.Portal.Partner.GetPartners";
            //DataCaching data = new DataCaching();
            //data.RemoveCache(key);
			
		}
        public static void DeletePartner(int partnerId)
		{
            DataAccessProvider.Instance().DeletePartner(partnerId);
            //const string key = "Butterfly.Portal.Partner.GetPartners";
            //DataCaching data = new DataCaching();
            //data.RemoveCache(key);
		}
	}
}
